Learn Python in 7 Days by Mohit

Learn Python in 7 Days by Mohit

Author:Mohit
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2017-05-22T10:15:19+00:00


Let's take an example to understand if and else conditions:

password= raw_input("Enter the passwordt")

if password=="MI6":

print "Welcome Mr. Bond."

else:

print "Access Denied."

Here, if the password is entered wrongly, the interpreter will immediately execute statement inside the else block. Here, the control statement is divided into two blocks one is the if block and the other is the else block. At one time, the interpreter will execute either of the two blocks:

The if...elif...else statement



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.